import { Injector, NgModule, Optional, SkipSelf } from '@angular/core'

@NgModule({})
export class InjectorModule {
  public static injector: Injector = null
  constructor(private injector: Injector, @Optional() @SkipSelf() parentModule: InjectorModule) {
    if (parentModule) {
      throw new Error('InjectorModule is already loaded. Import it in the AppModule only')
    }
    console.log(this.injector)
    InjectorModule.injector = this.injector
  }
}
